import { rcaNumberFormat } from './common.js'
import { commonTableOption } from './common.js'
export const tableOption = {
  ...commonTableOption,
  selection: true,
  height: 450,
  column: [{
    width: 160,
    type: 'date',
    label: '计算周期',
    prop: 'calcTime',
    valueFormat: 'yyyy-MM-dd',
    searchSpan: 12,
    searchRange: true,
    search: true,
    slot: true
  }, {
    width: 130,
    type: 'select',
    label: '清分规则',
    dicUrl: '/support/swpmticketcardtypeparam/dictClearRulesAll',
    cascaderItem: ["subClearRules"],
    search: true,
    props: {
      label: 'label',
      value: 'value'
    },
    prop: 'clearRules'
  }, {
    width: 130,
    searchLabelWidth:100,
    type: 'select',
    label: '子清分规则',
    dicUrl: '/support/swpmticketcardtypeparam/dictClearRulesAll/{{key}}',
    search: true,
    dicFlag: false,
    props: {
      label: 'label',
      value: 'value'
    },
    prop: 'subClearRules'
  }, {
    width: 130,
    searchLabelWidth:100,
    type: 'select',
    label: '适用运营商',
    props: {
      label: 'operatorsName',
      value: 'operators'
    },
    dicUrl: '/rca/swckclearrules/listoperators',
    search: true,
    prop: 'operators'
  }, {
    type: 'select',
    label: '数据来源',
    search: true,
    dicData: [{
      label: '系统计算',
      value: '1'
    }, {
      label: '人工添加',
      value: '2'
    }],
    prop: 'dataSource'

  }, {
    width: 180,
    type: 'input',
    label: '清分比例（%）',
    prop: 'countTicket'
  },{
    type: 'select',
    label: '使用状态',
    search: true,
    searchValue: '1',
    dicData: [{
      label: '使用中',
      value: '1'
    }, {
      label: '暂停使用',
      value: '2'
    }],
    prop: 'usedState'
  },{
      type: 'date',
      label: '创建时间',
      width: 160,
      prop: 'createTime',
      format: 'yyyy-MM-dd HH:mm:ss',                  
      valueFormat: 'yyyy-MM-dd HH:mm:ss',
    }, {
    width: 150,
    label: '操作',
    prop: 'menu',
    slot: true
  },]
}

export const preivewTableOption = {
  ...commonTableOption,
  height: 400,
  column: [{
    type: 'select',
    label: '线路',
    prop: 'lineCode',
    props: {
      label: 'name',
      value: 'code'
    },
    dicUrl: '/support/swparamline/dictsecondname',
  }, {
    type: 'input',
    label: '清分比例（%）',
    prop: 'countTicket'
  },]
}

export const tableOptionAdd = {
  border: true,
  index: true,
  align: "center",
  labelWidth: 160,
  submitBtn:false,
  emptyBtn:false,
  column: [{
      label: "开始时间",
      prop: "beginTime",
      type: "date",
      format: "yyyy-MM-dd",
      valueFormat: "yyyy-MM-dd",
      rules: [{
        required: true,
        message: "请选择开始时间",
        trigger: "blur"
      }]
    }, {
      label: "结束时间",
      prop: "endTime",
      type: "date",
      format: "yyyy-MM-dd",
      valueFormat: "yyyy-MM-dd",
      rules: [{
        required: true,
        message: "请选择结束时间",
        trigger: "blur"
      }]
    }, {
      width: 200,
      type: 'select',
      label: '清分规则',
      dicUrl: '/support/swpmticketcardtypeparam/dictClearRulesAll',
      cascaderItem: ["subClearRules"],
      search: true,
      props: {
        label: 'label',
        value: 'value'
      },
      prop: 'clearRules',
      rules: [{
        required: true,
        message: "请选择清分规则",
        trigger: "blur"
      }],
      display: true ,// 动态显隐控制不能删除
    }, {
      width: 130,
      searchLabelWidth:100,
      type: 'select',
      label: '子清分规则',
      dicUrl: '/support/swpmticketcardtypeparam/dictClearRulesAll/{{key}}',
      search: true,
      dicFlag: false,
      props: {
        label: 'label',
        value: 'value'
      },
      prop: 'subClearRules',
      rules: [{
        required: true,
        message: "请选择子清分规则",
        trigger: "blur"
      }],
    },  {
      width: 200,
      searchLabelWidth:100,
      type: 'select',
      label: '适用运营商',
      props: {
        label: 'operatorsName',
        value: 'operators'
      },
      dicUrl: '/rca/swckclearrules/listoperators',
      search: true,
      prop: 'operators',
    }, {
      type: "input",
      precision: 2,
      label: "清分比例（%）",
      prop: "countTicket",
      rules: [{
        required: true,
        message: "请输入清分比例",
        trigger: "blur"
      }]
    },{
      type: 'select',
      prop: 'usedState',
      label: '使用状态',
      dicData: [{
        label: '使用中',
        value: '1'
      }, {
        label: '暂停使用',
        value: '2'
      }],
      rules: [{
        required: true,
        message: "请选择使用状态",
        trigger: "blur"
      }]
    },
  ]
};

export const tableOptionAddDetail = {
  border: true,
  index: true,
  indexLabel: "序号",
  align: "center",
  column: [{
    type: 'select',
    label: '线路',
    prop: 'lineCode',
    slot: true,
    props: {
      label: 'name',
      value: 'code'
    },
    dicUrl: '/support/swparamline/dictsecondname',
    cell: true,
    rules: [{
      required: true,
      message: "请选择线路",
      trigger: "blur"
    }],
    display: true ,// 动态显隐控制不能删除
  }, {
    type: "input",
    precision: 2,
    label: '清分比例（%）',
    prop: 'countTicket',
    cell: true,
    rules: [{
      required: true,
      message: "请输入清分比例",
      trigger: "blur"
    }]
  }]
};

export const tableOptionOneSided = {
  refreshBtn:false,
  columnBtn:false,
  addBtn:false,
  editBtn:false,
  menu:false,
  submitBtn: false,
  emptyBtn: false,
  column: [
      {
        span: 8,
        type: "month",
        label: "清分日期",
        prop: "cleanDate",
        disabled: false,
        format: 'yyyy-MM',
        valueFormat: 'yyyy-MM-dd'
      }
  ]
}

export const tableOptionOneSidedDetail = {
  border: true,
  index: true,
  indexLabel: "序号",
  align: "center",
  selection: false,
  addBtn: false,
  delBtn: false,
  column: [{
    type: 'select',
    label: '线路',
    prop: 'lineCode',
    props: {
      label: 'name',
      value: 'code'
    },
    //cascaderItem: ["glineCode"],
    dicUrl: '/support/swparamline/getLineAll',
    cell: true,
    rules: [{
      required: true,
      message: "请选择线路",
      trigger: "blur"
    }],
    display:true,
  }, 
  // {
  //   type: 'select',
  //   label: '线路1',
  //   prop: 'glineCode',
  //   cell: true,
  //   props: {
  //     label: "name",
  //     value: "glineCode"
  //   },
  //   dicFlag: false,
  //   dicUrl: '/support/swparamline/getGLine/{{key}}',
  // },
  //  {
  //   type: 'select',
  //   label: '运营商',
  //   prop: 'serviceOrg',
  //   props: {
  //     label: 'name',
  //     value: 'operatorId'
  //   },
  //   dicUrl: '/support/swparamline/getGLine/{{key}}',
  // }, 
  {
    type: "number",
    precision: 6,
    label: '金额',
    prop: 'money',
    cell: true,
    rules: [{
      required: true,
      message: "请输入清分金额",
      trigger: "blur"
    }]
  }]
};